package com.syher.quartz.core.config.pool;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * Created by shenyuhang on 2018/2/25.
 */
public class ThreadPoolRejectedExecutionHandler implements RejectedExecutionHandler {

    private static final Logger logger = LoggerFactory.getLogger(ThreadPoolRejectedExecutionHandler.class);

    @Override
    public void rejectedExecution(Runnable runnable, ThreadPoolExecutor executor) {
        logger.info(runnable.toString() + ": has been rejected.");
        //TODO: 超出线程池的处理能力时，缓存任务信息
    }
}
